package com.study.service1.controller;

import java.util.Arrays;

public class Study {

    public static void main(String[] args) {
        int[] nums = {-1,-1,0,2,1};
        Arrays.sort(nums);
        int[][] result = new int[nums.length][3];
        int result_num = 0;
        for (int i = 0; i < nums.length; i++) {
            int el1 = nums[i];
            for (int j = i + 1; j < nums.length; j++) {
                int el2 = nums[j];
                for (int k = j + 1; k < nums.length; k++) {
                    int el3 = nums[k];
                    if ((el1 + el2 + el3) == 0) {
                        int[] ret = {el1,el2,el3};
                        result[result_num] = ret;
                        result_num++;
                    }
                }
            }
        }
        for (int[] e : result) {
            System.out.println(Arrays.toString(e));
        }
    }
}
